//index.js
//获取应用实例
const app = getApp()
import drawQrcode from "../../utils/weapp.qrcode.esm";
Page({
  data: {
    qrCodeUrl:'',
    backImagrUrl:"http://dh1.file.xinsong17.com/FgfkVZ5D6CeFy7Xud2RL2b3PPar2",
    userInfo: {},
    canvasHidden: false,
    ewmurl: 'cdfa'
  },
  onLoad: function () {
    this.createQRCode();
  },
  drawCanvas(){
     
  },
  createQRCode(){
    let that = this;
    drawQrcode({
      width: 60,
      height: 60,
      canvasId: 'qrcode_canvas',
      text: that.data.ewmurl || '',
      callback: function(e){
        console.log('xx.........');
        wx.canvasToTempFilePath({
          canvasId: 'qrcode_canvas',
          success: function (res) {
            var tempFilePath = res.tempFilePath;
            console.log(tempFilePath)
            that.setData({
              temporarycodeUrl: tempFilePath
            })
          },
          fail: function (res) {
            console.log(res);
          }
        });
        if(fn){fn()};
      }
    })
  }
})
